﻿using Microsoft.Xna.Framework;

namespace Tequila.AugmentedReality.CameraStates
{
    internal class LandscapeRightCameraBaseState : CameraBaseState
    {
        public LandscapeRightCameraBaseState(int layoutWidth, int layoutHeight, int radius) : 
            base(layoutWidth, layoutHeight, radius)
        {
        }

        protected override void SetCameraView()
        {
            View = Matrix.CreateLookAt(Vector3.UnitZ, Vector3.Zero, new Vector3(-1, 0, 0));
        }

        protected override Vector3 ProjectPlacePosition(Matrix rotation, Vector3 placeVector)
        {
            var attitude = ConvertRotationToXNACoordinates(rotation);

            //convert world coordinate system point to XNA coordinates
            var world = Matrix.CreateWorld(placeVector, Vector3.UnitZ, new Vector3(-1, 0, 0));

            //need to project it from 3D space in wcs to 2D space on the screen coordinates
            //need to rotate back for phone
            return ProjectVectorToScreenCoordinates(attitude, world);
        }
    }
}
